import Vue from 'vue'
import headerTab from '@/components/headerTab'
import login from '@/views/show_login_error/login'
import error from '@/views/show_login_error/error'
import show_device from '@/views/show_device/show_device'
import device_detail from '@/views/show_device/device_detail'
import add_mark from '@/views/show_device/add_mark'
import show_calllog from '@/views/show_calllog/show_calllog'
import show_apks from '@/views/show_apks/show_apks'
import show_contacts from '@/views/show_contacts/show_contacts'
import show_location from '@/views/show_location/show_location'
import show_sms from '@/views/show_sms/show_sms'
import show_wifis from '@/views/show_wifis/show_wifis'
import wifi_detail from '@/views/show_wifis/wifi_detail'
import show_images from '@/views/show_images/show_images'
import show_logManager from '@/views/show_logManager/show_logManager'
import show_reportManager from '@/views/show_reportManager/show_reportManager'

const routes = [{
        path: '/',
        component: headerTab,
        children: [{
            path: '',
            name: 'show_device',
            component: show_device,
            meta: {
                needAuth: false
            }
        }, {
            path: '/device_detail',
            name: 'device_detail',
            component: device_detail,
            meta: {
                needAuth: false
            }
        }, {
            path: '/add_mark',
            name: 'add_mark',
            component: add_mark,
            meta: {
                needAuth: false
            }
        }, {
            path: '/show_calllog',
            name: 'show_calllog',
            component: show_calllog,
            meta: {
                needAuth: false
            }
        }, {
            path: '/show_apks',
            name: 'show_apks',
            component: show_apks,
            meta: {
                needAuth: false
            }
        }, {
            path: '/show_contacts',
            name: 'show_contacts',
            component: show_contacts,
            meta: {
                needAuth: false
            }
        }, {
            path: '/show_location',
            name: 'show_location',
            component: show_location,
            meta: {
                needAuth: false
            }
        }, {
            path: '/show_sms',
            name: 'show_sms',
            component: show_sms,
            meta: {
                needAuth: false
            }
        }, {
            path: '/show_wifis',
            name: 'show_wifis',
            component: show_wifis,
            meta: {
                needAuth: false
            }
        }, {
            path: '/wifi_detail',
            name: 'wifi_detail',
            component: wifi_detail,
            meta: {
                needAuth: false
            }
        }, {
            path: '/show_images',
            name: 'show_images',
            component: show_images,
            meta: {
                needAuth: false
            }
        }, {
            path: '/show_logManager',
            name: 'show_logManager',
            component: show_logManager,
            meta: {
                needAuth: false
            }
        }, {
            path: '/show_reportManager',
            name: 'show_reportManager',
            component: show_reportManager,
            meta: {
                needAuth: false
            }
        }]
    },
    {
        path: '/login',
        name: 'login',
        component: login,
        meta: {
            needAuth: false
        }
    },
    {
        path: '/*',
        name: 'error',
        component: error,
        meta: {
            needAuth: false
        }
    }
];

// routes.beforeEach((to, from, next) => {
//     if (!to.meta.needAuth) {
//         next(true)
//     } else {
//         if (store.getters.isLogin) {
//             next()
//         } else {
//             next({ name: 'Login', query: { lastPath: to.fullPath } });
//         }
//     }
// })

export default routes